import java.awt.BorderLayout;

import java.awt.EventQueue;

import javax.naming.InitialContext;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import java.awt.FlowLayout;
import javax.swing.JTable;
import javax.swing.SwingConstants;
import java.awt.CardLayout;
import java.awt.GridLayout;
import javax.swing.JLabel;
import java.awt.Component;
import javax.swing.Box;
import java.awt.GridBagLayout;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JComboBox;

import DBUtility.SearchCondition;
import DBUtility.SearchInfo;
import DBUtility.SqlOperator;
import Database.Database;

import java.awt.GridBagConstraints;
import java.sql.Connection;
import javax.swing.JScrollPane;


public class OakFrame extends JFrame {
    
    /**
     * 
     */
    private static final long serialVersionUID = 1L;
    private JPanel contentPane;
    private JTable table_money;
    private JTable table_flux;
    
    /**
     * Launch the application.
     */
    public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                try {
                    OakFrame frame = new OakFrame();
                    frame.init();
                    frame.setVisible(true);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }
    
    public void init() {
        
    }
    
    public void Test() {
        Connection conn = Database.getConnection();
        SearchInfo searchInfo = new SearchInfo();
        
        Database database = new Database();
        
        
        SearchCondition searchCondition = new SearchCondition();
        searchCondition.AddCondition("trade_date", "20111009", SqlOperator.Equal);
        //searchCondition.AddCondition("trade_type", "xxxxx", SqlOperator.LessThan);
        System.err.println(searchCondition.BuildConditionSql());
        
        
        double i = database.getColumnSum(conn, "trade_money", "station_detail_daily", searchCondition.BuildConditionSql());
        System.err.println(i);
    }
    
    /**
     * Create the frame.
     */
    public OakFrame() {
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setBounds(100, 100, 640, 480);
        contentPane = new JPanel();
        contentPane.setToolTipText("");
        contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
        setContentPane(contentPane);
        contentPane.setLayout(new CardLayout(0, 0));
        
        JPanel report = new JPanel();
        contentPane.add(report, "name_21410674863549");
        report.setLayout(new BorderLayout(0, 0));
        
        JPanel panel_11 = new JPanel();
        report.add(panel_11, BorderLayout.NORTH);
        
        JButton button_report = new JButton("\u751F\u6210\u65E5\u62A5\u6570\u636E");
        panel_11.add(button_report);
        
        JPanel panel_12 = new JPanel();
        report.add(panel_12, BorderLayout.CENTER);
        panel_12.setLayout(new GridLayout(0, 1, 0, 0));
        
        JLabel lbl_money = new JLabel("\u5BA2\u6D41\u91CF\u53CA\u6536\u5165\u60C5\u51B5");
        panel_12.add(lbl_money);
        
        JScrollPane scrollPane_11 = new JScrollPane();
        panel_12.add(scrollPane_11);
        
        table_money = new JTable();
        scrollPane_11.setViewportView(table_money);
        
        JLabel lbl_flux = new JLabel("\u5206\u7968\u79CD\u8FDB\u51FA\u7AD9\u5BA2\u6D41\u7EDF\u8BA1");
        panel_12.add(lbl_flux);
        
        JScrollPane scrollPane_12 = new JScrollPane();
        panel_12.add(scrollPane_12);
        
        table_flux = new JTable();
        scrollPane_12.setViewportView(table_flux);
        
        JPanel search = new JPanel();
        contentPane.add(search, "name_21418263048331");
        search.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
        
        JButton btnNewButton_2 = new JButton("New button");
        search.add(btnNewButton_2);
        
        JButton btnNewButton_3 = new JButton("New button");
        search.add(btnNewButton_3);
    }
    
}
